home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / pango-1.0 / pango / pango-attributes.h next >
Encoding:
C/C++ Source or Header  |  2006-04-25  |  9.6 KB  |  268 lines

  1. /* Pango
  2.  * pango-attributes.h: Attributed text
  3.  *
  4.  * Copyright (C) 2000 Red Hat Software
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Library General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
  14.  * Library General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Library General Public
  17.  * License along with this library; if not, write to the
  18.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.  * Boston, MA 02111-1307, USA.
  20.  */
  21.  
  22. #ifndef __PANGO_ATTRIBUTES_H__
  23. #define __PANGO_ATTRIBUTES_H__
  24.  
  25. #include <pango/pango-font.h>
  26. #include <glib-object.h>
  27.  
  28. G_BEGIN_DECLS
  29.  
  30. /* PangoColor */
  31.  
  32. typedef struct _PangoColor PangoColor;
  33.  
  34. struct _PangoColor
  35. {
  36.   guint16 red;
  37.   guint16 green;
  38.   guint16 blue;
  39. };
  40.  
  41. #define PANGO_TYPE_COLOR pango_color_get_type ()
  42. GType       pango_color_get_type (void) G_GNUC_CONST;
  43.  
  44. PangoColor *pango_color_copy     (const PangoColor *src);
  45. void        pango_color_free     (PangoColor       *color);
  46. gboolean    pango_color_parse    (PangoColor       *color,
  47.                   const char       *spec);
  48.  
  49. /* Attributes */
  50.  
  51. typedef struct _PangoAttribute    PangoAttribute;
  52. typedef struct _PangoAttrClass    PangoAttrClass;
  53.                   
  54. typedef struct _PangoAttrString   PangoAttrString;
  55. typedef struct _PangoAttrLanguage PangoAttrLanguage;
  56. typedef struct _PangoAttrInt      PangoAttrInt;
  57. typedef struct _PangoAttrSize     PangoAttrSize;
  58. typedef struct _PangoAttrFloat    PangoAttrFloat;
  59. typedef struct _PangoAttrColor    PangoAttrColor;
  60. typedef struct _PangoAttrFontDesc PangoAttrFontDesc;
  61. typedef struct _PangoAttrShape    PangoAttrShape;
  62.  
  63. #define PANGO_TYPE_ATTR_LIST pango_attr_list_get_type ()
  64. typedef struct _PangoAttrList     PangoAttrList;
  65. typedef struct _PangoAttrIterator PangoAttrIterator;
  66.  
  67. typedef enum
  68. {
  69.   PANGO_ATTR_INVALID,           /* 0 is an invalid attribute type */
  70.   PANGO_ATTR_LANGUAGE,        /* PangoAttrLanguage */
  71.   PANGO_ATTR_FAMILY,        /* PangoAttrString */
  72.   PANGO_ATTR_STYLE,        /* PangoAttrInt */
  73.   PANGO_ATTR_WEIGHT,        /* PangoAttrInt */
  74.   PANGO_ATTR_VARIANT,        /* PangoAttrInt */
  75.   PANGO_ATTR_STRETCH,        /* PangoAttrInt */
  76.   PANGO_ATTR_SIZE,        /* PangoAttrSize */
  77.   PANGO_ATTR_FONT_DESC,        /* PangoAttrFontDesc */
  78.   PANGO_ATTR_FOREGROUND,    /* PangoAttrColor */
  79.   PANGO_ATTR_BACKGROUND,    /* PangoAttrColor */
  80.   PANGO_ATTR_UNDERLINE,        /* PangoAttrInt */
  81.   PANGO_ATTR_STRIKETHROUGH,    /* PangoAttrInt */
  82.   PANGO_ATTR_RISE,        /* PangoAttrInt */
  83.   PANGO_ATTR_SHAPE,        /* PangoAttrShape */
  84.   PANGO_ATTR_SCALE,             /* PangoAttrFloat */
  85.   PANGO_ATTR_FALLBACK,          /* PangoAttrInt */
  86.   PANGO_ATTR_LETTER_SPACING,    /* PangoAttrInt */
  87.   PANGO_ATTR_UNDERLINE_COLOR,     /* PangoAttrColor */
  88.   PANGO_ATTR_STRIKETHROUGH_COLOR, /* PangoAttrColor */
  89.   PANGO_ATTR_ABSOLUTE_SIZE      /* PangoAttrSize */
  90. } PangoAttrType;
  91.  
  92. typedef enum {
  93.   PANGO_UNDERLINE_NONE,
  94.   PANGO_UNDERLINE_SINGLE,
  95.   PANGO_UNDERLINE_DOUBLE,
  96.   PANGO_UNDERLINE_LOW,
  97.   PANGO_UNDERLINE_ERROR
  98. } PangoUnderline;
  99.  
  100. struct _PangoAttribute
  101. {
  102.   const PangoAttrClass *klass;
  103.   guint start_index;    /* in bytes */
  104.   guint end_index;    /* in bytes. The character at this index is not included */
  105. };
  106.  
  107. typedef gboolean (*PangoAttrFilterFunc) (PangoAttribute *attribute,
  108.                      gpointer        data);
  109.  
  110. typedef gpointer (*PangoAttrDataCopyFunc) (gconstpointer data);
  111.  
  112. struct _PangoAttrClass
  113. {
  114.   /*< public >*/
  115.   PangoAttrType type;
  116.   PangoAttribute * (*copy) (const PangoAttribute *attr);
  117.   void             (*destroy) (PangoAttribute *attr);
  118.   gboolean         (*equal) (const PangoAttribute *attr1, const PangoAttribute *attr2);
  119. };
  120.  
  121. struct _PangoAttrString
  122. {
  123.   PangoAttribute attr;
  124.   char *value;
  125. };
  126.  
  127. struct _PangoAttrLanguage
  128. {
  129.   PangoAttribute attr;
  130.   PangoLanguage *value;
  131. };
  132.  
  133. struct _PangoAttrInt
  134. {
  135.   PangoAttribute attr;
  136.   int value;
  137. };
  138.  
  139. struct _PangoAttrFloat
  140. {
  141.   PangoAttribute attr;
  142.   double value;
  143. };
  144.  
  145. struct _PangoAttrColor
  146. {
  147.   PangoAttribute attr;
  148.   PangoColor color;
  149. };
  150.  
  151. struct _PangoAttrSize
  152. {
  153.   PangoAttribute attr;
  154.   int size;
  155.   guint absolute : 1;
  156. };
  157.  
  158. struct _PangoAttrShape
  159. {
  160.   PangoAttribute attr;
  161.   PangoRectangle ink_rect;
  162.   PangoRectangle logical_rect;
  163.   
  164.   gpointer              data;
  165.   PangoAttrDataCopyFunc copy_func;
  166.   GDestroyNotify        destroy_func;
  167. };
  168.  
  169. struct _PangoAttrFontDesc
  170. {
  171.   PangoAttribute attr;
  172.   PangoFontDescription *desc;
  173. };
  174.  
  175. PangoAttrType    pango_attr_type_register (const gchar          *name);
  176.  
  177. PangoAttribute * pango_attribute_copy          (const PangoAttribute *attr);
  178. void             pango_attribute_destroy       (PangoAttribute       *attr);
  179. gboolean         pango_attribute_equal         (const PangoAttribute *attr1,
  180.                         const PangoAttribute *attr2);
  181.  
  182. PangoAttribute *pango_attr_language_new      (PangoLanguage              *language);
  183. PangoAttribute *pango_attr_family_new        (const char                 *family);
  184. PangoAttribute *pango_attr_foreground_new    (guint16                     red,
  185.                           guint16                     green,
  186.                           guint16                     blue);
  187. PangoAttribute *pango_attr_background_new    (guint16                     red,
  188.                           guint16                     green,
  189.                           guint16                     blue);
  190. PangoAttribute *pango_attr_size_new          (int                         size);
  191. PangoAttribute *pango_attr_size_new_absolute (int                         size);
  192. PangoAttribute *pango_attr_style_new         (PangoStyle                  style);
  193. PangoAttribute *pango_attr_weight_new        (PangoWeight                 weight);
  194. PangoAttribute *pango_attr_variant_new       (PangoVariant                variant);
  195. PangoAttribute *pango_attr_stretch_new       (PangoStretch                stretch);
  196. PangoAttribute *pango_attr_font_desc_new     (const PangoFontDescription *desc);
  197.  
  198. PangoAttribute *pango_attr_underline_new           (PangoUnderline underline);
  199. PangoAttribute *pango_attr_underline_color_new     (guint16        red,
  200.                             guint16        green,
  201.                             guint16        blue);
  202. PangoAttribute *pango_attr_strikethrough_new       (gboolean       strikethrough);
  203. PangoAttribute *pango_attr_strikethrough_color_new (guint16        red,
  204.                             guint16        green,
  205.                             guint16        blue);
  206.  
  207. PangoAttribute *pango_attr_rise_new          (int                         rise);
  208. PangoAttribute *pango_attr_scale_new         (double                      scale_factor);
  209. PangoAttribute *pango_attr_fallback_new      (gboolean                    enable_fallback);
  210. PangoAttribute *pango_attr_letter_spacing_new (int                        letter_spacing);
  211.  
  212. PangoAttribute *pango_attr_shape_new           (const PangoRectangle       *ink_rect,
  213.                             const PangoRectangle       *logical_rect);
  214. PangoAttribute *pango_attr_shape_new_with_data (const PangoRectangle       *ink_rect,
  215.                         const PangoRectangle       *logical_rect,
  216.                         gpointer                    data,
  217.                         PangoAttrDataCopyFunc       copy_func,
  218.                         GDestroyNotify              destroy_func);
  219.  
  220. GType              pango_attr_list_get_type      (void) G_GNUC_CONST;
  221. PangoAttrList *    pango_attr_list_new           (void);
  222. PangoAttrList *    pango_attr_list_ref           (PangoAttrList  *list);
  223. void               pango_attr_list_unref         (PangoAttrList  *list);
  224. PangoAttrList *    pango_attr_list_copy          (PangoAttrList  *list);
  225. void               pango_attr_list_insert        (PangoAttrList  *list,
  226.                           PangoAttribute *attr);
  227. void               pango_attr_list_insert_before (PangoAttrList  *list,
  228.                           PangoAttribute *attr);
  229. void               pango_attr_list_change        (PangoAttrList  *list,
  230.                           PangoAttribute *attr);
  231. void               pango_attr_list_splice        (PangoAttrList  *list,
  232.                           PangoAttrList  *other,
  233.                           gint            pos,
  234.                           gint            len);
  235.  
  236. PangoAttrList *pango_attr_list_filter (PangoAttrList       *list,
  237.                        PangoAttrFilterFunc  func,
  238.                        gpointer             data);
  239.  
  240. PangoAttrIterator *pango_attr_list_get_iterator  (PangoAttrList  *list);
  241.  
  242. void               pango_attr_iterator_range    (PangoAttrIterator     *iterator,
  243.                                                  gint                  *start,
  244.                                                  gint                  *end);
  245. gboolean           pango_attr_iterator_next     (PangoAttrIterator     *iterator);
  246. PangoAttrIterator *pango_attr_iterator_copy     (PangoAttrIterator     *iterator);
  247. void               pango_attr_iterator_destroy  (PangoAttrIterator     *iterator);
  248. PangoAttribute *   pango_attr_iterator_get      (PangoAttrIterator     *iterator,
  249.                                                  PangoAttrType          type);
  250. void               pango_attr_iterator_get_font (PangoAttrIterator     *iterator,
  251.                                                  PangoFontDescription  *desc,
  252.                          PangoLanguage        **language,
  253.                                                  GSList               **extra_attrs);
  254. GSList *          pango_attr_iterator_get_attrs (PangoAttrIterator     *iterator);
  255.  
  256.  
  257. gboolean pango_parse_markup (const char                 *markup_text,
  258.                              int                         length,
  259.                              gunichar                    accel_marker,
  260.                              PangoAttrList             **attr_list,
  261.                              char                      **text,
  262.                              gunichar                   *accel_char,
  263.                              GError                    **error);
  264.  
  265. G_END_DECLS
  266.  
  267. #endif /* __PANGO_ATTRIBUTES_H__ */
  268.